package cn.neusoft.luofa603.yuejian_29.adapter;

import android.content.Context;
import android.view.View;
import android.view.ViewGroup;
import android.widget.ImageView;

import com.bumptech.glide.Glide;
import com.jude.rollviewpager.RollPagerView;
import com.jude.rollviewpager.adapter.LoopPagerAdapter;

import cn.neusoft.luofa603.yuejian_29.Constants;

/**
 * Created by Administrator on 2017/11/9.
 */

public class ImageLoopAdapter extends LoopPagerAdapter {

    String[] imgs = new String[0];
    private Context mContext;
    public ImageLoopAdapter(Context mContext,RollPagerView rollCI) {
        super(rollCI);
        this.mContext = mContext;
    }

    @Override
    public View getView(ViewGroup container, int position) {
        ImageView view = new ImageView(container.getContext());
        view.setScaleType(ImageView.ScaleType.CENTER_CROP);
        view.setLayoutParams(new ViewGroup.LayoutParams(ViewGroup.LayoutParams.MATCH_PARENT, ViewGroup.LayoutParams.MATCH_PARENT));
        Glide.with(mContext).load(Constants.URL[position]).into(view);
        return view;
    }

    @Override
    public int getRealCount() {
        return Constants.URL.length;
    }
}
